
using System;
using System.Collections;
using System.Web.UI.WebControls;

using Awaken.Framework;
using Nullables;

namespace Northwind.Domain.Entities
{
    public partial class Territory : IEntity
    {
        protected static TerritoryBroker broker;
        public static TerritoryBroker Broker
        {
            get
            {
                if (broker == null)
                {
                    broker = new TerritoryBroker();
                }
                return broker;
            }
        }

        #region IEntity Members

        public string EntityID
        {
            get { return string.Empty; }
        }
        
        public string EntityName
        {
            get { return string.Empty; }
        }

        public void Save()
        {
            Broker.Save(this);
        }
        
        public void Delete()
        {
            Broker.Delete(this);
        }
        
        #endregion
    
        #region Constructor
        
        public Territory()
        {
            // Default, no arg constructor.
        }
        
        #endregion
            
        #region Public Properties / Protected Fields
                        
        
        protected string _TerritoryID;
        public string TerritoryID
        {
            get{ return _TerritoryID; }
            set{ _TerritoryID=value; }
        }
        
        protected string _TerritoryDescription;
        public string TerritoryDescription
        {
            get{ return _TerritoryDescription; }
            set{ _TerritoryDescription=value; }
        }
        
        protected System.Int32? _RegionID;
        public System.Int32? RegionID
        {
            get{ return _RegionID; }
            set{ _RegionID=value; }
        }
        
        
        
        
        
        // Many-To-One: Region.RegionID
        protected Region _Region;
        public Region Region
        {
            get{ return _Region; }
            set{ _Region=value; }
        }
                
        
        
        // Many-To-Many: EmployeeTerritories
        protected IList _EmployeeList;
        public IList EmployeeList
        {
            get{ return _EmployeeList; }
            set{ _EmployeeList=value; }
        }
        
        
        #endregion
    }
    
    #region TerritoryBroker

    public partial class TerritoryBroker : IBroker
    {
        #region IBroker Members

        public Type EntityType
        {
            get { return typeof(Territory); }
        }
        
        public Territory GetByID(object id)
        {
            return (Territory)Awaken.Framework.Gateway.GetByID(EntityType, id);
        }

        public IList GetAll()
        {
            return Awaken.Framework.Gateway.GetAll(EntityType);
        }

        public void Save(IEntity entity)
        {
            Awaken.Framework.Gateway.Save(entity);
        }
        
        public void Delete(IEntity entity)
        {
            Awaken.Framework.Gateway.Delete(entity);
        }
        
        #endregion
    }
    #endregion
}
